home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Please help ?!
- Date: 28 Jan 1996 22:25:42 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Jan28152542@qcd.lanl.gov>
- References: <4dm889$3hs@neptunus.pi.net> <4drnv1$cr@news.iag.net> <4drq5i$cr@news.iag.net>
- <4e6hse$dvl@ns.RezoNet.NET> <310a2389.49571776@nntp.ix.netcom.com>
- <4eg6h8$1db5@info.estec.esa.nl> <TANMOY.96Jan28100725@qcd.lanl.gov>
- <4egm05$1da3@info.estec.esa.nl>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: 328pt@SPOD2.dev.esoc.esa.de's message of 28 Jan 1996 20:23:33 GMT
-
- In article <4egm05$1da3@info.estec.esa.nl> 328pt@SPOD2.dev.esoc.esa.de
- (Phil Tregoning) writes:
- <snip>
- tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) writes:
-
- [Talk about casting return from malloc() when stdlib.h is not
- #include'd]
-
- >[...] The compiler _need not_ warn about an undeclared
- >function (i.e. such a warning is not mandated by ANSI: no warning is
- >however ever prohibited). Converting an int to a pointer without a
- >cast, however, needs a warning. On such compilers, then, avoiding the
- >cast can often help spot a fatal error.
-
- Does converting one type of pointer to another (excluding void *)
- without an appropriate cast require a warning, or is that also up
- to the compliler ? K&R2 says this is illegal.
-
- Pointer conversions without a cast are allowed only when converting a
- non-function pointer to/from a void* pointer. Every other conversion
- involving pointers is allowed with and need explicit casts. The
- validity of such conversions between non-function pointers with cast
- depends on alignment, and hence care must be taken if portable code is
- desired . A function and a non-function pointer may not be mixed in
- portable code at all, though all function pointers may be cast to one
- another portably.
-
- A diagnostic is never required when an explicit cast is allowed and
- present.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-